package com.tengju.bff.interfaces.app.common.assembler;

import com.tengju.bff.interfaces.app.common.vo.ProtocolVersionVO;
import com.tengju.user.domain.model.protocol.ProtocolType;
import com.tengju.user.domain.model.protocol.ProtocolVersion;

import java.util.List;
import java.util.stream.Collectors;

public class UserProtocolAssembler {

    public static List<ProtocolType> protocolIdToModel(List<Integer> protocolIds) {
        return protocolIds.stream().map(ProtocolType::fromId).collect(Collectors.toList());
    }

    public static List<ProtocolVersionVO> domainToVo(List<ProtocolVersion> versions) {

        return versions.stream().map(protocolVersion ->
                new ProtocolVersionVO(protocolVersion.getProtocolType().getId(),
                protocolVersion.getProtocolVersion()))
                .collect(Collectors.toList());

    }
}
